﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Security.Cryptography;
using System.Text;

namespace LikeTry.Logic
{
    public class UserOper
    {
        public static bool ValidationRegCode(string code)
        {
            return true ;
        }

        public static bool AddNewUser(string email, string pwd)
        {
            var result = false;
            var hashValue = SHA512.Create().ComputeHash(Encoding.UTF8.GetBytes(email+pwd));
            var hashPwd = Convert.ToBase64String(hashValue);
            ////Add user email ,pwd into DB.
            return result;
        }

        public static bool Logon(string email, string pwd)
        {
            var result = true;
            var hashValue = SHA512.Create().ComputeHash(Encoding.UTF8.GetBytes(email + pwd));
            var hashPwd = Convert.ToBase64String(hashValue);
            if (hashPwd == "WOKmHsgGc5ITF53FuHhxNXmH2Qiq3c1m6j1bjQ6+ENAjXAY11hcARKPjVY2XA+tVYrtsfPK+OMVcIpnioeEoCQ==")
            {
                //If email match pwd return true
                result = true;
            }

            return result;
        }

    }
}